import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VisitRecordVO, VisitRecordForm, VisitRecordQuery } from '@/api/wiki/visitRecord/types';

/**
 * 查询拜访记录列表
 * @param query
 * @returns {*}
 */

export const listVisitRecord = (query?: VisitRecordQuery): AxiosPromise<VisitRecordVO[]> => {
  return request({
    url: '/wiki/visitRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询拜访记录详细
 * @param id
 */
export const getVisitRecord = (id: string | number): AxiosPromise<VisitRecordVO> => {
  return request({
    url: '/wiki/visitRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增拜访记录
 * @param data
 */
export const addVisitRecord = (data: VisitRecordForm) => {
  return request({
    url: '/wiki/visitRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改拜访记录
 * @param data
 */
export const updateVisitRecord = (data: VisitRecordForm) => {
  return request({
    url: '/wiki/visitRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除拜访记录
 * @param id
 */
export const delVisitRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/wiki/visitRecord/' + id,
    method: 'delete'
  });
};
